const { buildSchema } = require('graphql');

module.exports = buildSchema(`
    type User {
        id: ID!
        name: String!
        email: String!
        age: Int!
        createdAt: String!
    }

    type AuthPayload {
        token: String!
        user: User!
    }

    type Query {
        me: User
        user(id: ID!): User
        users: [User]
    }

    type Mutation {
        register(
            name: String!
            email: String!
            password: String!
            age: Int!
        ): AuthPayload

        login(
            email: String!
            password: String!
        ): AuthPayload

        updateUser(
            name: String
            age: Int
            email: String
        ): User

        deleteUser: Boolean
    }
`); 